<?php
require 'Home/Controller/Controller.php ';
//require 'Admin/Model/UserModel.php';
require 'Home/Model/IndexModel.php';
class IndexController extends Controller{
	function __Construct(){
		parent::__Construct();
		$this->model = new IndexModel();
	}
	function index(){
		//$getCarphotoList = $this->model->getCarphotoList();
		//var_dump($getList);




		$data=$this->model->getct();

		$tcl = $this->model->getCbl($data);

		$data1=$this->model->getbt();


		//$getVideoByDowntimes = $this->model->getVideoByDowntimes();
		//var_dump($data2);
	/*	$this->assign('list',$data1);
		$this->display(); 
		$this->assign('list',$data2);
		$this->display(); 
		$this->assign('list',$data3);
		$this->display(); 
		$this->assign('list',$data4);
		$this->display(); */
		include 'Home/View/Index/index.php';
	}
	function Login()
	{

$result=$this->model->login();
//var_dump($result);
//$redirect=$this->model->redirect($url, $msg);
if($result){
   /* $_SESSION['user'] = $result;
	  
	  $redirect('index.php?c=index&m=index', '登录成功!');*/
	  echo '<a href="admin.php?c=carphoto&m=listcarphoto">登录成功</a>';
	  	
  }else{
	 /* $redirect('index.php?c=index&m=index', '用户名或密码错误！请重新登录！');	  
	   */
	 	  echo '<a href="index.php?c=index&m=index">失败：返回</a>';
  } 
	}
	function register()
	{
		$result=$this->model->add();
//$redirect=$this->model->redirect($url, $msg);
if($result){
   /* $_SESSION['user'] = $result;
	  
	  $redirect('index.php?c=index&m=index', '登录成功!');*/
	  echo '<a href="index.php?c=index&m=index">注册成功</a>';
	  	
  }else{
	 /* $redirect('index.php?c=index&m=index', '用户名或密码错误！请重新登录！');	  
	   */
	 	  echo '<a href="index.php?c=index&m=index">注册失败</a>';
  } 
	}






		function search(){
		$text=$_POST;
		var_dump($text);
$getCarphotolist = $this->model->getCarphotoList();
		$getCarTypelist  = $this->model->getCartypeList();
		//$getCarbrandByid  = $this->model->getCarbrandById($id);
		//$getCarphotoByid  = $this->model->getCarphotoById($id);
		//$getCartypeByid = $this->model->getCartypeById($id);
		$show=$this->model->search($text);



$url="index.php?c=list&m=show&id=".$show['cid'];

  header("refresh:0;url=$url"); 
		//  header("refresh:3;url=index.php?c=index&m=show&id=$show['cid']"); 
	
	


	}
	
}
?>